#include<stdio.h>
#include<stdlib.h>
//efine DEBUG
#ifdef DEBUG
#include<conio.h>
#endif
typedef struct ngua{
    long v;
    long index;
};
int sosanh(const void *a,const void *b){
    return -((*((ngua*)a)).v-(*((ngua*)b)).v);
}
ngua tontan[100001],vuate[100001];
long n,i,j,u;
long dua[100001];
void input(){
    FILE *fpinp=fopen("RACE.INP","r");
    fscanf(fpinp,"%ld",&n);
    for(i=0;i<n;i++){
        fscanf(fpinp,"%ld",&tontan[i].v);
        tontan[i].index=i;
    }
    qsort(tontan,n,sizeof(ngua),sosanh);
    for(i=0;i<n;i++){
        fscanf(fpinp,"%ld",&vuate[i].v);
        vuate[i].index=i;
    }
    qsort(vuate,n,sizeof(ngua),sosanh);
    fclose(fpinp);
}
void process(){
    int last=n-1,first=0;
    for(i=0;i<n;i++){
        if(vuate[i].v>=tontan[first].v){
            dua[vuate[i].index]=last;
            last--;
        }else{
            dua[vuate[i].index]=first;
            first++;
        }
    }
}
void output(){
    long a=0;
    FILE *fpout=fopen("RACE.OUT","w");
    for(i=0;i<n;i++){
        if(i==0)fprintf(fpout,"%ld %ld",dua[vuate[i].index]+1,i+1);
        else fprintf(fpout,"\n%ld %ld",dua[vuate[i].index]+1,i+1);
        if(tontan[dua[vuate[i].index]].v>vuate[i].v)a++;
        #ifdef DEBUG
        printf("%4ld %4ld\n",tontan[dua[vuate[i].index]].v,vuate[i].v);
        #endif
    }
    //fprintf(fpout,"\n%ld",a);
    fclose(fpout);
}
int main(){
    input();
    process();
    output();
    #ifdef DEBUG
        for(i=0;i<n;i++)printf("(%ld,%ld)\t",tontan[i].v,vuate[i].v);
        getch();
    #endif
    return 0;
}
